package com.example.designer.factory.factory;

import com.example.designer.factory.Car;
import com.example.designer.factory.impl.BaoMa;
import com.example.designer.factory.impl.BenChi;
import com.example.designer.factory.impl.DaZhon;

/**
 * 工厂类 : 创建对应对象
 */
public class CarFactory {

    public static Car getCar(String type) {
        if (type == null && type ==""){
            return null;
        }
        switch (type){
            case "BAOMA":
                return new BaoMa();
            case "BENCHI":
                return new BenChi();
            case "DAZHON":
                return new DaZhon();
            default:
                return null;
        }
    }
}
